﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace LineChartControlTest
{
    /// <summary>
    /// LogFittingCurve.xaml 的交互逻辑
    /// </summary>
    public partial class LogFittingCurve : Window
    {
        public LogFittingCurve()
        {
            InitializeComponent();
            AddData();
        }

        private void AddData()
        {
            double[] x = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            double[] y = new double[] { 1.9398, 2.9836, 5.9890, 10.2, 20.7414, 23.232, 69.5855, 82.5836, 98.1779, 339.3256 };

            LineCharts.LogFittingCurve ds = new LineCharts.LogFittingCurve();
            ds.LineColor = Brushes.Blue;
            ds.XDrawStart = 0;
            ds.XDrawEnd = 11;
            ds.ShowType = LineCharts.LogFittingCurve.LogFittingShowTypeEnum.Log;
            ds.LineThickness = 2;
            ds.SeriesName = "Log Scale";
            ds.Symbols.SymbolType = LineCharts.Symbols.SymbolTypeEnum.Diamond;
            ds.Symbols.SymbolSize = 12;
            ds.Symbols.FillColor = Brushes.Black;
            ds.Symbols.BorderColor = Brushes.Black;
            for (int i = 0; i < x.Length; i++)
            {
                ds.RawData.Add(x[i], y[i]);
            }
            logChart.SeriesCollection.AddRawData(ds);

            LineCharts.LogFittingCurve ds1 = new LineCharts.LogFittingCurve();
            ds1.LineColor = Brushes.Blue;
            ds1.XDrawStart = 0;
            ds1.XDrawEnd = 11;
            ds1.ShowType = LineCharts.LogFittingCurve.LogFittingShowTypeEnum.Origin;
            ds1.LineThickness = 2;
            ds1.SeriesName = "Linear Scale";
            ds1.Symbols.SymbolType = LineCharts.Symbols.SymbolTypeEnum.Diamond;
            ds1.Symbols.SymbolSize = 12;
            ds1.Symbols.FillColor = Brushes.Black;
            ds1.Symbols.BorderColor = Brushes.Black;
            for (int i = 0; i < x.Length; i++)
            {
                ds1.RawData.Add(x[i], y[i]);
            }
            linearChart.SeriesCollection.AddRawData(ds1);
        }
    }
}
